package simonxianyu.learn.springmybatis.db.dbsvc;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import simonxianyu.learn.springmybatis.db.BaseMapper;

/**
 *
 * Created by simon on 2017/2/20.
 */
@Transactional(readOnly = true)
abstract public class BaseDbSvc<M extends BaseMapper<T,ID>, T, ID>{
  @Autowired
  protected M mapper;

  public T getById(ID id) {
    return mapper.getById(id);
  }

  public long countAll() {
    return mapper.countAll();
  }
}
